package com.example.examplebus.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.examplebus.entity.BusRoute;
import com.example.examplebus.mapper.BusRouteMapper;
import com.example.examplebus.service.BusRouteService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BusRouteServiceImpl extends ServiceImpl<BusRouteMapper, BusRoute> implements BusRouteService {

    @Override
    public List<BusRoute> findByRouteName(String routeName) {
        QueryWrapper<BusRoute> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("route_name", routeName);
        return list(queryWrapper);
    }

    @Override
    public BusRoute findByRouteNumber(String routeNumber) {
        QueryWrapper<BusRoute> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("route_number", routeNumber);
        return getOne(queryWrapper);
    }
}

